package br.com.gnk.logger;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class ExceptionAspect
{
    private Log log = LogFactory.getLog(this.getClass());
    
    @AfterThrowing(pointcut = "execution(* br.com.gnk..*(..))", throwing = "error")
    public void logAfterThrowing(JoinPoint joinPoint, Throwable error) {
        
    	// tratamento geral
    	
        fazerTratamentoEspecifico(error) ;       
        
        String destino = "paginaErro" + error.getClass().getName() + ".jsf";
        
      }

	protected void fazerTratamentoEspecifico(Throwable error) {
		// TODO Auto-generated method stub
		
	}
    
}